#ifndef _MUNIX_CTRLBUS_H
#define	_MUNIX_CTRLBUS_H
/*******************************************************************************
 ** Name: types.h                                                             **
 ** Description:              **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the license.txt within              **
 ** this distribution or at http://www.munixos.net/licensing.                 **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at $HOME/license.txt.                   **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 **                                                                           **
 ** Copyright (c) 2009-2010  Barry Gian James <bjames@munixos.net>            **
 ** All rights reserved.                                                      **
 **                                                                           **
 ** Ref: $HeadURL$
 ******************************************************************************/
// Portions (C) 2011 OpenHouseware, LLC.
// All Rights Reserved

// $Id$
// Last Modified $DateTime$ by $Author$
#include "common.h"
#include "bus.h"
//#include "pqueue.h"
#include "slist.h"

#define CTRL_BUS_LINES      5

enum class CtrlSigAddr : uint8
{
    Reserved=0x00, Interrupt=0x01, InterruptACK, IORead, IOWrite,
    MemRead, MemWrite, ConfigRead, ConfigWrite, ALE, SysInt,
    RESET, AMPSysMsg, Errno, SynClock, MPUReq, SysTime, Exec,
    ATBIOS_VPutch, SuBuSttD, VideoRead, VideoWrite,
    CacheRead, CacheWrite
};
struct ControlSignal
{
    BusRequestPriority       priority;
    CtrlSigAddr signal;
    uint8       from;
    uint8       to;
};


class ControlBus : public SystemBus
{
public:
    ControlBus();
    ControlBus(const ControlBus&) = delete;
    ~ControlBus();

    // Allows objects/peripherals to register with the control
    // bus and be assigned an ID.
    //uint8   Register(Peripheral *);
    uint8   Register(Bus *);
    void    SendSignal(uint8 remote, uint8 signal);

private:
    IOPort *   pins[CTRL_BUS_LINES+1];
    SList<Bus *> attached;
    //static PriorityQueue CtrlBusQueue;
};



#endif	/* _MUNIX_CTRLBUS_H */

